package org.dcits.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.dcits.model.Useracct;

public class ObjectToUseracct {
	public static Useracct objeacToUseracct(Map<String, Object> data) {		
		Useracct useracct = new Useracct();		
		useracct.setUserId((Integer)data.get("user_id"));
		useracct.setAcctNo((String)data.get("acct_no"));
		useracct.setAcctSalary((Double)data.get("acct_salary"));
		useracct.setCcy((String)data.get("ccy"));
		useracct.setPwd((String)data.get("pwd"));
		
		return useracct; 
	}
	
	public static List<Useracct> objeacToUseracct(List<Map<String, Object>> data){
		List<Useracct> list = new ArrayList<Useracct>();	
		if(data == null || data.isEmpty()) {
			return list;
		}
		
		for(Map<String, Object> map : data) {
			list.add(objeacToUseracct(map));
		}
		return list;
	}
}
